using System.Collections.Generic;
using UnityEngine;

public class BlinkingTrigger : MonoBehaviour
{
	private List<Collider> enteredCollider = new List<Collider>();

	private Collider triggerCollider;

	public bool NotEnteredCar
	{
		get
		{
			return enteredCollider.Count == 0 || enteredCollider.TrueForAll((Collider c) => c == null || c.isTrigger);
		}
	}

	private void OnTriggerEnter(Collider other)
	{
		CarBehavior componentInParent = other.GetComponentInParent<CarBehavior>();
		if (componentInParent != null)
		{
			enteredCollider.Add(other);
		}
	}

	private void OnTriggerExit(Collider other)
	{
		CarBehavior componentInParent = other.GetComponentInParent<CarBehavior>();
		if (componentInParent != null)
		{
			enteredCollider.Remove(other);
		}
	}

	public void SetCollider(Collider col)
	{
		triggerCollider = col;
	}

	public void SetTriggerActive(bool value)
	{
		triggerCollider.isTrigger = value;
	}
}
